/**
 * 
 */
	
    var $addStockUrl ="http://"+ window.location.host +$("#wrapper-nav").attr("contextPath") + "/ajax/addUserStock.do";
    var $deleteStockUrl ="http://"+ window.location.host +$("#wrapper-nav").attr("contextPath") + "/ajax/deleteUserStock.do";

//    var url = window.location.origin + "/refreshIndex.do";
    
    function addUserStock($ticker,$exchangeCD){
    	if($ticker == undefined || $exchangeCD == undefined){
    		alert("ticker 或 exchangeCD为空");
    	}
    	$remark="";
    	 $.ajax({
    	        url: $addStockUrl,
    	        cache: false,
    	        type: "GET",
    	        dataType: "json",
    	        data:{
    	        	"ticker":$ticker,
    	        	"exchangeCD":$exchangeCD,
    	        	"remark":$remark
    	        },
    	        success: function(result){
    	        	if(result != undefined && result.success == true){
    	        		alert("添加成功");
    	        	}else{
    	        		alert("添加失败");
    	        	}
    	        	
    	        },
    	        error: function(result){
    	        	//alert("跑批失败");
    	        }
    	    });
    }
    
    
    function deleteUserStock($id){
    	if($id == undefined ){
    		alert("id为空");
    	}
    	 $.ajax({
    	        url: $deleteStockUrl,
    	        cache: false,
    	        type: "GET",
    	        dataType: "json",
    	        data:{
    	        	"id":$id
    	        },
    	        success: function(result){
    	        	if(result != undefined && result.success == true){
    	        		alert("删除成功");
    	        		window.location.reload();
    	        	}else{
    	        		alert("删除失败");
    	        		window.location.reload();
    	        	}
    	        	
    	        },
    	        error: function(result){
    	        	//alert("跑批失败");
    	        }
    	    });
    }